/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.desanonymerUtilisateurs;

import static com.desanonymerUtilisateurs.ConnectDatabase.con;
import static com.desanonymerUtilisateurs.ConnectDatabase.connectDatabase;
import static com.desanonymerUtilisateurs.ConnectDatabase.doRequest;
import static com.desanonymerUtilisateurs.ConnectDatabase.verifPassword;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author Kevin
 */
public class Utilisateur 
{
    private String userName;
    private String password;
    public static ConnectDatabase connect = new ConnectDatabase();
    
    public Utilisateur(String userName, String password, String mailAdress)
    {
        this.userName = userName;
        this.password = password;
    }
    
    public static void sendSondage(String question, boolean visibility)
    {
        try 
        {
            Statement stmt = con.createStatement();
            stmt.executeUpdate("INSERT INTO sondage(question, visibilite_reponse, userName_sondeur) VALUES ('hello ?', 1, 'userNameTest')");
            System.out.println("sondage inseré");
        } 
        catch (SQLException e) 
        {
            e.printStackTrace();
        }
    }
    
    public static void vote(int reponse, int idSondage)
    {
        try 
        {
            Statement stmt = con.createStatement();
            stmt.executeUpdate("INSERT INTO vote(login_repondant, id_sondage, reponse) VALUES ('userNameTest'," + idSondage + ", 1)");
            System.out.println("réponse envoyée");
        } 
        catch (SQLException e) 
        {
            e.printStackTrace();
        }
    }
    
   /* public static void main(String[] args) 
    {
        connect.connectDatabase("jdbc:mysql://localhost/SimpleChat", "root", "");
        sendSondage("ezzklfn ? ", true);
        vote(1, 9);
    }*/
}